package com.hebrf.sdk.dialog;

/**
 * Created by lyb on 2017/6/13.
 * Email: 1373519715@qq.com
 * Blog: https://littleiii.github.io
 */

import android.app.Activity;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.TextView;

/**
 * 提醒类对话框
 */
public class WarnDialog implements BaseDialog
{
    private AlertDialog mAD;
    private View mView;
    private String content;
    private TextView tvContent;
    private TextView tvYes;
    public WarnDialog(Activity activity) {
        mView=View.inflate(activity,0,null);
        mAD= new AlertDialog.Builder(activity).
                setView(mView).
                create();
        tvContent= (TextView) mView.findViewById(0);
        tvYes=(TextView) mView.findViewById(0);
        tvYes.setOnClickListener((view)->{
                cancel();

        });
    }

    @Override
    public String getContent() {
        return content;
    }

    @Override
    public void setContent(String s) {
        content=s;
        tvContent.setText(s);
    }

    @Override
    public AlertDialog getDialog() {

        return mAD;
    }

    @Override
    public void show() {
        if (mAD == null) {
            return;
        }
        mAD.show();
    }

    @Override
    public void cancel() {
        if (mAD == null) {
            return;
        }
        mAD.cancel();
    }


}
